import React,{Component} from 'react';
import { Route, Link, withRouter } from 'react-router-dom';

class RouteProperty extends Component {
  constructor(props) {
    super(props)
  }
  render() {
    return (
      <div>
        <h3>测试route的属性</h3>
        <span>render：func， 用于内联渲染</span>
        <ul>
          <li>
            <Link to='/inline'>内联方式</Link>
          </li>
          <li>
          <Link to='/cool'>传入组件方式</Link>
          </li>
        </ul>
        
        <Route path='/inline' render={() => <h1>inline route</h1>} />
        <FadingRoute path='/cool' component={TestCom} />
      </div>
    )
  }
}
const FadingRoute = ({component: Component, ...rest }) => (
  <Route {...rest} render={ props => (
    <Component {...props} />
  )} />
  
)
const TestCom = () => (
  <div>
    this is component!
  </div>
)
export default withRouter(RouteProperty)
